package com.jrebeltest.game;


import com.jme.app.AbstractGame;
import com.jme.app.SimpleGame;
import com.jme.bounding.BoundingSphere;
import com.jme.light.PointLight;
import com.jme.math.Quaternion;
import com.jme.math.Vector3f;
import com.jme.renderer.ColorRGBA;
import com.jme.scene.Node;
import com.jme.scene.TriMesh;
import com.jme.scene.shape.Box;
import com.jme.scene.shape.Teapot;
import com.jme.scene.shape.Tube;
import com.jme.scene.state.ZBufferState;
import com.jme.util.Debug;

public class JMonkeyApp extends SimpleGame {
    private float angle = 0;
    private Quaternion rotQuat = new Quaternion();
    private Vector3f axis = new Vector3f(1, 1, 0).normalizeLocal();
    private TriMesh myTriMesh;

    public static void main(String[] args) {
        JMonkeyApp app = new JMonkeyApp();
        app.setConfigShowMode(AbstractGame.ConfigShowMode.AlwaysShow);
        app.start();
    }

    protected void simpleUpdate() {
        if (timer.getTimePerFrame() < 1) {
            angle = angle + (timer.getTimePerFrame() * 1);
            if (angle > 360) {
                angle = 0;
            }
        }
        rotQuat.fromAngleNormalAxis(angle, axis);
        myTriMesh.setLocalRotation(rotQuat);
    }

   /*
    protected void simpleInitGame() {
        display.setTitle("JMonkeyApp Tube");
        myTriMesh = new Tube("Tube", 16, 12, 30);
        myTriMesh.getLocalTranslation().z = -30;
        myTriMesh.setModelBound(new BoundingSphere());
        myTriMesh.updateModelBound();
        rootNode.attachChild(myTriMesh);

    }
    */

    protected void simpleInitGame() {
        display.setTitle("JMonkeyApp clear");
        myTriMesh = new Teapot("Teapot");
        myTriMesh.getLocalTranslation().z = 10;
        myTriMesh.setModelBound(new BoundingSphere());
        myTriMesh.updateModelBound();
        rootNode.attachChild(myTriMesh);

    }


}

